package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.EmDamage;
import com.ruoyi.system.mapper.EmDamageMapper;
import com.ruoyi.system.service.IEmDamageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 灾害类别Service业务层处理
 *
 * @author yangcan
 * @date 2023-03-07
 */
@Service
public class EmDamageServiceImpl implements IEmDamageService
{
    @Autowired
    private EmDamageMapper emDamageMapper;

    /**
     * 查询灾害类别
     *
     * @param id 灾害类别主键
     * @return 灾害类别
     */
    @Override
    public EmDamage selectEmDamageById(Long id)
    {
        return emDamageMapper.selectEmDamageById(id);
    }

    /**
     * 查询灾害类别列表
     *
     * @param emDamage 灾害类别
     * @return 灾害类别
     */
    @Override
    public List<EmDamage> selectEmDamageList(EmDamage emDamage)
    {
        return emDamageMapper.selectEmDamageList(emDamage);
    }

    /**
     * 新增灾害类别
     *
     * @param emDamage 灾害类别
     * @return 结果
     */
    @Override
    public int insertEmDamage(EmDamage emDamage)
    {
        emDamage.setCreateTime(DateUtils.getNowDate());


        return emDamageMapper.insertEmDamage(emDamage);
    }

    /**
     * 修改灾害类别
     *
     * @param emDamage 灾害类别
     * @return 结果
     */
    @Override
    public int updateEmDamage(EmDamage emDamage)
    {
        emDamage.setUpdateTime(DateUtils.getNowDate());
        return emDamageMapper.updateEmDamage(emDamage);
    }

    /**
     * 批量删除灾害类别
     *
     * @param ids 需要删除的灾害类别主键
     * @return 结果
     */
    @Override
    public int deleteEmDamageByIds(Long[] ids)
    {
        return emDamageMapper.deleteEmDamageByIds(ids);
    }

    /**
     * 删除灾害类别信息
     *
     * @param id 灾害类别主键
     * @return 结果
     */
    @Override
    public int deleteEmDamageById(Long id)
    {
        return emDamageMapper.deleteEmDamageById(id);
    }
}
